﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="adminProgram.aspx.cs" Inherits="Admin_adminProgram" %>
<%@ Register Src="adminfoot.ascx" TagName="adminfoot" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
     <link rel="stylesheet" href="imgs/admin.css" type="text/css" media="all" />
    <script type="text/javascript" src="../DotNet_net/js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="imgs/GetAjax.js"></script>
    <script type="text/javascript" src="../DotNet_net/js/common.js"></script>
</head>
<body onload="$('#loading').hide()">
<form id="form1" runat="server">
<div class="container" id="cpcontainer">
<div id="loading" style="display:block">   
        <div class="loading-indicator">   
            页面正在加载中...   
        </div>   
</div>
<table class="tb">
<tr class="thead"><th colspan="15">
    成套方案管理</th></tr>	
<tr><td align="left" colspan="10">  方案类别：
<select name='selectDp' id='pcDp_select' style='width:192px;' onchange="change()">
<%=programClassDp() %>
</select>

</td>
</tr>
  <tr bgcolor="#f5fafe">
	<td style="width: 20%">ID<a href="#"><img src="imgs/minus.gif" title="按ID排序" /></a></td>
	<td style="width: 14%"> 方案名称</td>
	<td style="width:10%">
        关联产品</td>
	<td style="width: 18%">
        方案类别</td>
    <td style="width: 10%">
        方案排序</td>
	<td style="width: 40%" align="left">
        (推荐,最新,首页展示,屏蔽,编辑,删除,属性)操作</td>
  </tr>
  
      <asp:Repeater ID="Repeater1" runat="server">
      <ItemTemplate>          
<tr bgcolor="#f5fafe">
	<td ><input type="checkbox" value='<%#Eval("programId") %>' name="m_id"   class="checkbox" /><%#Eval("programId")%>.<a href="javascript:void(0)"><%#Eval("programName")%></a></td>
	<td style="width: 179px"><input name='programName<%#Eval("programId") %>' style="width:200px;" size="3" type="text"   value='<%#Eval("programName")  %>'/></td>
    <td>
    <input name="product_hid<%#Eval("programId") %>" value="<%#Eval("productId") %>"  type="hidden" />    
    <a href="#msg" onclick="GivePower(this,this.title)" title='<%#Eval("programId") %>'>管理关联产品</a>
    
    </td>	
	<td><input name='programClassId<%#Eval("programId") %>'
            readonly="readonly" size="3" style="width:250px;" title="<%#Eval("programClassId") %>"
            type="text" value='<%#getProgramClass(Convert.ToInt32(Eval("programClassId"))) %>' /></td>	
	<td>
        <input name='programSort<%#Eval("programId") %>' size="3" type="text"   value='<%#Eval("programSort") %>'/></td>	
	<td>
	   <input id="Button1" type="button" value="编辑" class='btn' title='<%#Eval("programId") %>' onclick="javascript:location.href='EditProgram.aspx?action=edit&pid='+this.title" />	 	
	  <input id="btnDel" type="button" value="删除" class='btn' title='<%#Eval("programId") %>' onclick="if(confirm('确定要删除吗')){$('#loading').show();ajax_get('?action=delAll&id='+this.title+$('#HiddenUrl').attr('value'),'',function(msg){$('#cpcontainer').empty().append(msg);$('#loading').hide()});}else{return false}" />	 
	</td>
  </tr>
        
      </ItemTemplate>
      </asp:Repeater>

<tr><td colspan="11"><div class="cuspages"><div class="pages" id="pro" runat="server"><div style="width:90%; float:left;">全选<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(this.checked,'m_id')" />反选<input type="checkbox" name="chkothers" id="chkothers" class="checkbox" onclick="checkOthers('m_id')" />
<input type="button" value="批量修改" class="btn" onclick="doPostEdit('','m_id')" />&nbsp;
<select name='selectDp' id='pcDp_move' style='width:192px;'>
<%=programClassDp() %>
</select>
<input type="button"   value="批量移动" class="btn" onclick="doPostMove('','m_id')"/>&nbsp;</div><div style="width:10%; float:right;"><input type="button" value="批量删除" onclick="doPostDeletes('','m_id')" class="btn" style="color:Red;"  /></div> 
    </div></div></td>
</tr>

<tr><td colspan="11"><div class="cuspages"><div id="a" class="pages">
 <%htmlPaging();%></div></div></td>
</tr>
</table>
<%=input%>
  <uc1:adminfoot ID="Adminfoot1" runat="server" />
</div>
<%--删除,移动,修改start--%>
<script type="text/javascript" >
    function  doPostDeletes(url,sname)
    {          
        var ids=getIDList(sname);
        if(ids!="")
        {
            if((confirm("确定要删除这些记录?"))==true)
            {
                $("#loading").show();
                url=convertURL(url+"?action=delAll&id="+ids+$("#HiddenUrl").attr("value"));
                $("#loading").show();
                ajax_get(url,'',function(msg)
                {                   
                   $("#cpcontainer").empty().append(msg);
                   $("#loading").hide();
                });
	        }
	    }
	    else
	    {
	        alert("您还没有选择要删除的项");	        
	        return false;
	    }
    }    
    function  doPostEdit(url,sname)
    {    
     
        var ids=getIDList(sname);
        var Param='';
        if(ids!="")
        {
            if((confirm("确定要批量修改这些记录?"))==true)
            {   $("#loading").show();    
                  url=url+"?action=editAll&id="+ids+$("#HiddenUrl").attr("value"); 
                  for(var i=0;i<=ids.split(',').length-1;i++)
                  { 
                     var id=ids.split(',')[i];
                     Param+= "&programName"+id+"="+$("input[name='programName"+id+"']").attr("value")+                             
                             "&programSort"+id+"="+$("input[name='programSort"+id+"']").attr("value")+
                             "&programClassId"+id+"="+$("input[name='programClassId"+id+"']").attr("title")+
                             "&programKey"+id+"="+$("input[name='programKey"+id+"']").attr("value")+
                             "&programTitle"+id+"="+$("input[name='programTitle"+id+"']").attr("value")+
                             "&programDescription"+id+"="+$("input[name='programDes"+id+"']").attr("value")+
                             "&product_hid"+id+"="+$("input[name='product_hid"+id+"']").attr("value");
                  }
                  ajax_post(url,Param,function(msg,date)
                  {
                        $("#cpcontainer").empty().append(msg);
                        $("#loading").hide();                  
                  });
	        }
	    }
	    else
	    {
	        alert("您还没有选择要修改的项");	    
	        return;
	    }
    }
    
    function doPostMove(url,sname)
    {
     
        var ids=getIDList(sname);
        if(ids!="")
        {
            var yidong="";
            var Param="";
            yidong=$("#pcDp_move option:selected").attr("value");
            if((confirm("确定要移动这些记录?"))==true)
            {   $("#loading").show();
                url=convertURL(url+"?action=MoveAll&id="+yidong+"&pid="+ids+$("#HiddenUrl").attr("value"));
                 $("#loading").show();
                ajax_get(url,'',function(msg)
                {
                     $("#cpcontainer").empty().append(msg);
                     $("#loading").hide();
                    
                });
	        }
	    }
	    else
	    {
	        alert("您还没有选择移动项");	 
	        return false;
	    }
    } 
    
   function SelectKey(url)
   {
      $("#loading").show();
      url=convertURL("?key="+escape($("#keyword").attr("value"))+"&ClassId="+$("#pclassType option:selected").attr("value")+"&CurrentIndex=1");
       $("#loading").show();
      ajax_get(url,'',function(msg)
      {
        $("#cpcontainer").empty().append(msg);
        $("#loading").hide();
      });
       
   }
   
  function doGetIsBool(url,em,type,name)
  {
      url=convertURL("?action="+type+"&bo="+em.title+"&id="+em.lang+$("#HiddenUrl").attr("value"));
      $("#loading").show();
      ajax_get(url,'',function(msg)
      {
        if(msg==name)
        {
         
            $("#"+em.id).attr("value",name);
            $("#"+em.id).attr("title","false");
            $("#loading").hide();
        }
        else
        {
             $("#"+em.id).attr("value","已"+name);
              $("#"+em.id).attr("title","true");
             if(msg=="已屏蔽")
             {
                location.href=location.href;
             }
             $("#loading").hide();
        }
      });
  }
  function change()
  {
        location.href="adminProgram.aspx?programClassId="+$("#pcDp_select option:selected").attr("value");
  }
 </script>
<%--删除,移动,修改end--%>
    <script type="text/javascript" >
    function changePage(name)
    {

    }
    </script>
</form>
</body>
</html>
<script type="text/javascript">
function GivePower(tg,title)
{
   var  el=$(tg).prev()[0];
   _1=el;openWindow2(20,420,400,0);
	var msgDiv=document.getElementById("msg");
	var _t = tg.offsetTop;
    var _l = tg.offsetLeft;
    while (tg = tg.offsetParent){_t+=tg.offsetTop; _l+=tg.offsetLeft;}
    msgDiv.style.cssText+="border:1px solid #55BBFF;background: #C1E7FF;padding:1px 0px 1px 1px;height: auto;"
	msgDiv.style.top = (_t-1)+"px";
    msgDiv.style.left = (_l-1)+"px";
	msgDiv.innerHTML='<button type="button" class="btn" style="margin:0 6px 0 0;height:23px;float:right;padding:0;" onclick="closeWin()">关闭</button><iframe src="FileDownLoad/selectRole.aspx?programId='+title+'" scrolling="no" topmargin="0"  height:auto;overflow:auto;  marginwidth="0" marginheight="0" frameborder="0" align="center"  onload="this.height=this.contentWindow.document.documentElement.scrollHeight"></iframe>';
}
</script> 
